package pl.edu.agh.se.carsexpertsystem.model;

import java.util.LinkedList;
import java.util.List;

/**
 * Reprezentuje marke samochodu.
 * @author piotrek
 */
public class CarManufacturer {
    private String name;
    private Level prestige;
    private Level reliability;
    
    private List<CarModel> models = new LinkedList<>();

    public CarManufacturer(String name, Level prestige, Level reliability) {
        this.name = name;
        this.prestige = prestige;
        this.reliability = reliability;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Level getPrestige() {
        return prestige;
    }

    public void setPrestige(Level prestige) {
        this.prestige = prestige;
    }

    public Level getReliability() {
        return reliability;
    }

    public void setReliability(Level reliability) {
        this.reliability = reliability;
    }

    public List<CarModel> getModels() {
        return models;
    }
    
    public void addModel(CarModel model){
        model.setManufacturer(this);
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final CarManufacturer other = (CarManufacturer) obj;
        if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 71 * hash + (this.name != null ? this.name.hashCode() : 0);
        return hash;
    }
}
